<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <!-- 原型中的方法是可以相互访问的 -->
    <script>
        function Animal(cate,age,weight) {
            this.cate = cate;
            this.age = age;
            this.weight = weight;
        }
        function Animal(cate,age,weight) {
            this.cate = cate;
            this.age = age;
            this.weight = weight;
        }
        function Animal(cate,age,weight) {
            this.cate = cate;
            this.age = age;
            this.weight = weight;
        }
        Animal.prototype.eat = function () {
            console.log('爱吃竹子');
        }
        Animal.prototype.eat = function () {
            console.log('爱吃竹子');
        }
        Animal.prototype.eat = function () {
            console.log('爱吃竹子');
            this.sleep();
        }
        Animal.prototype.sleep = function () {
            console.log('爱睡觉');
            this.shot();
        }
        Animal.prototype.sleep = function () {
            console.log('爱睡觉');
            this.shot();
        }
        Animal.prototype.sleep = function () {
            console.log('爱睡觉');
            this.shot();
        }
        Animal.prototype.play = function () {
            console.log('跑步运动');
        }
        Animal.prototype.play = function () {
            console.log('跑步运动');
        }
        Animal.prototype.play = function () {
            console.log('跑步运动');
        }
        Animal.prototype.shot = function () {
            console.log('嗷呜');
        }
        Animal.prototype.shot = function () {
            console.log('嗷呜');
        }
        Animal.prototype.shot = function () {
            console.log('嗷呜');
        }
        var panda = new Animal('熊猫',2,'60kg');
        var panda = new Animal('熊猫',2,'60kg');
        var panda = new Animal('熊猫',2,'60kg');
        panda.eat();
        panda.eat();
        panda.eat();
        // 虽然方法加在原型上，但是原型上的方法可以通过实例对象调用
        // 两句话:
        // 原型中的方法是可以相互访问的
        // 虽然方法加在原型上，但是原型上的方法是可以通过实例对象调用的
    </script>
</body>
</html>